<?php
/**
 * 设置考核日
 */
apf_require_controller("Abstract");
apf_require_class("Bll_Jx_Setting");
class Setting_SetDaysController extends AbstractController {

    public function handle_request() {
        $params = $this->request->get_parameters();
        $this->set_bll = new Bll_Jx_Setting();

        if($this->request->is_post_method()){
            $this->add_params($params);
        }
        $per_list = $this->set_bll->get_performance_month(date('Y'));

        $this->request->set_attribute('per_list', $per_list);
        return 'Setting_SetDays';
    }
    private function add_params($params){

        $revicwMonth = $params['revicwMonth'];
        if(empty($revicwMonth)){
            $this->show_tips('ERROR_PARAM');
        }

        $m_list = Const_JxStatus::set_month_day();

        for($i=1;$i<8;$i++){
            if (!empty($params['step_date_'.$i])){
                $data1 = array(
                        'revicwMonth'=>$revicwMonth,
                        'step_status'=>$i,
                        'step_date'=>date('Ymd',strtotime($params['step_date_'.$i])),
                        'step_name'=>$m_list[$i]
                );
                $this->set_bll->set_check_day($data1);
            }
        }
    }
}